﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynORM.Interfaces
{
    //its implementation usually has identity-based equality semantics
    //it can be processed with Identity map and Unit of work in the layer above
    public interface IRow : IORMObject
    {
        string TableName { get; }
        IPrimaryKey PrimaryKey { get; } //uniquely identify Row. Does not change during row's lifetime

        //relations
        IEnumerable<IRelation> Relations { get; }
        IEnumerable<IForeignKey> ForeignKeys { get; }

        //fields 
        IEnumerable<IField> Fields { get; }

        //used to simplify field's value assignment
        //returns IField.FieldValue. fields that are in IEnumerable<IRelation> Relations can be get by means of this indexer too
        //but it's not allowed to change primary key field values (they inaccessable through this indexer). they identify the row. if need to do that create a new row.
        object this[string fieldName] { get; set; }
    }
}
